home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
.net 1998 May Disc 2
/
.net May 1998 disc 2.iso
/
ie401
/
ie31
/
iecore.cab
/
tabs.js
< prev
next >
Wrap
Text File
|
1997-11-25
|
2KB
|
82 lines
// Copyright (c) 1997 Microsoft Corporation. All rights reserved.
// tabs.js
var indexLocation = null;
var tocLocation = null;
function GetIndexLocation(){
return indexLocation;
}
function GetTocLocation(){
return tocLocation;
}
function SetIndexLocation(callerWindow, location){
indexLocation = GetDirectory(callerWindow.location.href) +
"/" + location;
}
function SetTocLocation(callerWindow, location){
tocLocation = GetDirectory(callerWindow.location.href) +
"/" + location;
}
function GetDirectory(pathname){
// given a full url to a document,
// return the directory the document lives in
var backPos = pathname.lastIndexOf("\\");
var forwardPos = pathname.lastIndexOf("/");
var sepPos = Math.max(backPos,forwardPos);
if (sepPos != -1) { // a seperator was found
return pathname.substring(0,sepPos);
}
else {
return pathname;
}
}
function SelectIndexTab(document){
var tabContentsDocument = document.parentWindow.parent.frames("index_bot").document;
SetActiveTabStyleSheet(document, "tab-index");
if (tabContentsDocument)
tabContentsDocument.location.replace(top.GetIndexLocation());
}
function SelectContentsTab(document){
var tabContentsDocument = document.parentWindow.parent.frames("index_bot").document;
SetActiveTabStyleSheet(document, "tab-contents");
if (tabContentsDocument)
tabContentsDocument.location.replace(top.GetTocLocation());
}
function SetActiveTabStyleSheet(document, styleSheet){
// disable all of the tab stylesheets
// (those that start with tab-) except for the one
// passed in
for (var i=0; i<document.styleSheets.length; i++)
// if the stylesheet has an id starting with options- (if it is one of ours)
if (document.styleSheets[i].id.indexOf("tab-") == 0) {
if (document.styleSheets[i].id == styleSheet){
document.styleSheets[i].disabled = false;
}
else {
document.styleSheets[i].disabled = true;
}
}
}